﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.BasicData.Infrastructure.Interface
{
    public interface IBaseRepository<T>where T : class
    {

        MyDbContext Context { get;set; }

        /// <summary>
        /// 新增方法
        /// </summary>
        /// <param name="entity">需要增加的数据</param>
        /// <returns>新增行数</returns>
        Task<int> CreateAsync(T entity);

        /// <summary>
        /// 新增批量方法
        /// </summary>
        /// <param name="entity">需要增加的数据</param>
        /// <returns>新增行数</returns>
        Task<int> CreateAsync(List<T> entity);

        /// <summary>
        /// 修改方法
        /// </summary>
        /// <param name="entity">需要修改的数据</param>
        /// <returns>修改行数</returns>
        Task<int> UpdateAsync(T entity);


        /// <summary>
        /// 修改批量方法
        /// </summary>
        /// <param name="entity">需要修改的数据</param>
        /// <returns>修改行数</returns>
        Task<int> UpdateAsync(List<T> entity);

        /// <summary>
        /// 根据Id进行单条件查询
        /// </summary>
        /// <param name="Id">实体Id</param>
        /// <returns>查询数据</returns>
        Task<T> GetValueAsync(int id);

        /// <summary>
        /// 搜索数据信息
        /// </summary>
        /// <returns>数据列表</returns>
        IQueryable<T> GetAll();
    }
}
